import 'package:fate_blind_box/theme/theme_color.dart';
import 'package:fate_blind_box/utils/assets.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';

import '../network/Api.dart';

//个人简介
class UserIntroduce extends StatefulWidget {
  var id;

  UserIntroduce(this.id, {Key? key}) : super(key: key);

  @override
  State<UserIntroduce> createState() => _UserIntroduceState();
}

class _UserIntroduceState extends State<UserIntroduce> {
  var _msg = "暂无简介";

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    if (widget.id.toString().isNotEmpty) {
      _getUserinfo(widget.id);
    }
  }

  // 查询好友简介
  _getUserinfo(String string) async {
    // if (widget.easeuserId.isEmpty) return;
    final res = await Api.getInstance().queryUserIntroduce(string);
    final data = res['msg'];
    if (data != null) {
      setState(() {
        _msg = data;
      });
    } else {
      if (kDebugMode) {
        print('------获取用户异常---------------' + res['msg']);
      }
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: getCommonAppBar("个人简介", color: Colors.black),

      body: Container(
        height: 300,
        width: MediaQuery
            .of(context)
            .size
            .width,
        padding: const EdgeInsets.all(15),
        margin: const EdgeInsets.all(15),
        decoration: BoxDecoration(
          color: ThemeColor.sendMsgColor,
          borderRadius:
          const BorderRadius.all(Radius.circular(5.0)),
        ),
        child: Text(
          _msg,
          style: const TextStyle(color: Colors.black, fontSize: 15),),

      ),
    );
  }
}
